//
//  BindingMailboxViewController.m
//  cityStar
//
//  Created by joyban on 14-12-27.
//  Copyright (c) 2014年 tiny. All rights reserved.
//

#import "BindingMailboxViewController.h"

@interface BindingMailboxViewController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UITextField *teiPhone;
@property (weak, nonatomic) IBOutlet UITextField *MailBox;
@property (weak, nonatomic) IBOutlet UITextField *SecendMailbox;
@property (weak, nonatomic) IBOutlet UIButton *quedinBtn;

@end

@implementation BindingMailboxViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"修改绑定邮箱";
    [self addBackButton];
    self.quedinBtn.layer.cornerRadius = 4;
    self.teiPhone.placeholder = @"请输入手机验证码";
    self.MailBox.placeholder = @"请输入新绑定邮箱地址";
    self.SecendMailbox.placeholder = @"请重复输入新绑定邮箱地址";
    
    self.teiPhone.returnKeyType = UIReturnKeyDone;
    self.teiPhone.delegate = self;
    self.MailBox.returnKeyType = UIReturnKeyDone;
    self.MailBox.delegate = self;
    self.SecendMailbox.returnKeyType = UIReturnKeyDone;
    self.SecendMailbox.delegate = self;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

#pragma - mark textDeletage

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    return YES;
}


- (IBAction)Yangzheng_Action:(id)sender
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"发送成功" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
    [alert show];
}

- (IBAction)Return_Action:(id)sender
{
    if([self.teiPhone.text isEqualToString:@""])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"验证码不能为空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else if([self.MailBox.text isEqualToString:@""])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"邮箱地址不能为空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else if ([self.SecendMailbox.text isEqualToString:@""])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"再一次输入邮箱地址不能为空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else if(![self.MailBox.text isEqualToString: self.SecendMailbox.text])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"两次邮箱地址不一致空" delegate:self cancelButtonTitle:@"确认" otherButtonTitles: nil];
        [alert show];
    }else{
        
    }

}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.teiPhone resignFirstResponder];
    [self.MailBox resignFirstResponder];
    [self.SecendMailbox resignFirstResponder];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
